﻿//============================================================
// 自动生成的代码
// 模块名:      Favorites 模型类
// 版本:        1.0   
// 生成时间:    2024-07-25 15:06:48
// 说明：为全自动产生，包含表名前缀
//============================================================

using SqlSugar;

namespace JLModel
{
    /// <summary>
    /// Favorites 模型类
    /// </summary>
    [Serializable()]
    [SugarTable("Favorites", TableDescription = "Favorites")]
    public partial class FavoritesModel
    {
        #region 私有变量

        /// <summary>
        /// 保存值有变化的属性名
        /// </summary>
        private List<string> _changeProperty = null;

        //对象是否初始化完，初始化完后再做信息修改,ChangeProperty列表记录修改的属性名
        private bool _isInitOK = false;

        //主键   
        private long? _ID;

        // 父文件夹ID  最上级为0
        private long? _FID = 0;
        // 名称
        private string _Name = String.Empty;
        // 网址
        private string _URL = String.Empty;
        // 数据类型  D，文件夹  U，网址链接
        private string _DataType = String.Empty;
        // 创建时间
        private DateTime? _CreateTime = Convert.ToDateTime("1900-01-01");

        #endregion

        #region 公共属性

        /// <summary>
        /// 对象是否初始化完，初始化完后再做信息修改,ChangeProperty列表记录修改的属性名
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public bool IsInitOK
        {
            get
            {
                return _isInitOK;
            }
            set
            {
                _isInitOK = value;
                if (value && _changeProperty == null)
                {
                    _changeProperty = new List<string>();
                }
            }
        }

        /// <summary>
        /// 记录修改内容的属性名
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public List<string> ChangeProperty
        {
            get { return this._changeProperty; }
            set
            {
                if (this._changeProperty != value)
                {
                    this._changeProperty = value;
                }
            }
        }

        /// <summary>
        /// 主键  
        /// </summary>
        [SugarColumn(ColumnName = "ID", IsPrimaryKey = true, IsNullable = false, IsIdentity = false, ColumnDescription = "")]
        public long? ID
        {
            get { return this._ID; }
            set
            {
                if (this._ID != value)
                {
                    this._ID = value;
                    OnChanged("ID");
                }
            }
        }

        /// <summary>
        /// 父文件夹ID  最上级为0
        /// </summary>
        [SugarColumn(ColumnName = "FID", IsPrimaryKey = false, IsNullable = false, IsIdentity = false, ColumnDescription = "父文件夹ID  最上级为0")]
        public long? FID
        {
            get { return this._FID; }
            set
            {
                if (this._FID != value)
                {
                    this._FID = value;
                    OnChanged("FID");
                }
            }
        }

        /// <summary>
        /// 名称
        /// </summary>
        [SugarColumn(ColumnName = "Name", IsPrimaryKey = false, IsNullable = true, Length = 1020, IsIdentity = false, ColumnDescription = "名称")]
        public string Name
        {
            get { return this._Name; }
            set
            {
                if (this._Name != value)
                {
                    this._Name = value;
                    OnChanged("Name");
                }
            }
        }

        /// <summary>
        /// 网址
        /// </summary>
        [SugarColumn(ColumnName = "URL", IsPrimaryKey = false, IsNullable = true, Length = 1020, IsIdentity = false, ColumnDescription = "网址")]
        public string URL
        {
            get { return this._URL; }
            set
            {
                if (this._URL != value)
                {
                    this._URL = value;
                    OnChanged("URL");
                }
            }
        }

        /// <summary>
        /// 数据类型  D，文件夹  U，网址链接
        /// </summary>
        [SugarColumn(ColumnName = "DataType", IsPrimaryKey = false, IsNullable = true, Length = 4, IsIdentity = false, ColumnDescription = "数据类型  D，文件夹  U，网址链接")]
        public string DataType
        {
            get { return this._DataType; }
            set
            {
                if (this._DataType != value)
                {
                    this._DataType = value;
                    OnChanged("DataType");
                }
            }
        }

        /// <summary>
        /// 创建时间
        /// </summary>
        [SugarColumn(ColumnName = "CreateTime", IsPrimaryKey = false, IsNullable = true, IsIdentity = false, ColumnDescription = "创建时间")]
        public DateTime? CreateTime
        {
            get { return this._CreateTime; }
            set
            {
                if (this._CreateTime != value)
                {
                    this._CreateTime = value;
                    OnChanged("CreateTime");
                }
            }
        }


        #endregion

        #region 方法

        /// <summary>
        /// 修改属性值事件，记录值变化的属性名
        /// </summary>
        /// <param name="propertyName">属性名</param>
        private void OnChanged(string propertyName)
        {
            if (IsInitOK)
            {
                if (_changeProperty == null)
                {
                    _changeProperty = new List<string>();
                }
                if (_changeProperty.IndexOf(propertyName) < 0)
                {
                    _changeProperty.Add(propertyName);
                }
            }
        }

        #endregion
    }
}